
import { _decorator } from 'cc';
import { ParticleItem } from './ParticleItem';
const { ccclass, property } = _decorator;

/**爆炸粒子 */
@ccclass('BoomParticle')
export class BoomParticle extends ParticleItem {

    protected particleCount: number = 30;
    protected createAnim() {
        let Pos = [0, 0, 0, 0];
        let SO = [1, 0, 1, 1];
        let d = 0.4;
        let Time = [d, d, d, 0];
        let Ease = [0, 0, 0, 0];
        let s0 = 0.5;
        let s1 = 0.15;
        let radius = 0.5;
        for (let i = 0; i < this.particleCount; ++i) {
            let radian = Math.random() * 6.28;
            Pos[2] = Math.cos(radian) * radius + Math.random() * 0.2;
            Pos[3] = Math.sin(radian) * radius + Math.random() * 0.2;

            SO[0] = s0 + Math.random() * s1;
            SO[1] = Math.random() * s1;
            this.cacheParticleAnim(i, Pos, SO, Time, Ease);
        }
    }

}
